package org.sy.lab.多线程基础._2_同步._1_synchronized._1_锁的对象;


/**
 * 实现Runnable来创建线程
 * 优点是可以继承其他的类，可以作为多个Thread的target实现资源共享
 */
public class MyThread implements Runnable {
	
	private ITick tick;
	
	public MyThread(ITick tick) {
		this.tick = tick;
	}
	
	@Override
	public void run() {
		
		for (int i = 0; i < 10; i++) {
			tick.subtract();
			try {
				Thread.sleep(10);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
